def main():
    y_or_n = 'n'
    while y_or_n != 'y':
        input_str = input("请依次输入性别、体重（kg）、身高（cm）、年龄（空格隔开）：")
        str_list = input_str.split(" ")
        try:
            gender = str_list[0]
            weight = float(str_list[1])
            height = float(str_list[2])
            age = int(str_list[3])
            if gender == '男':
                bmr = (10 * weight) + (6.25 * height) - (5 * age) + 5
            elif gender == '女':
                bmr = (10 * weight) + (6.25 * height) - (5 * age) - 161
            else:
                bmr = -1
            if bmr != -1:
                print("您的性别：{}，体重：{}kg，身高：{}cm，年龄：{}岁".format(gender, weight, height, age))
                print("您的基础代谢率：{}卡路里".format(bmr))
            else:
                print("暂不支持该性别")
        except ValueError:
            print("请输入正确的信息！")
        except IndexError:
            print("输入信息较少！")
        except:
            print("程序异常！")
        y_or_n = input("是否退出程序(y/n)")
    print("程序已退出！")
if __name__ == '__main__':
    main()